/*
* This file is part of QSerialDevice, an open-source cross-platform library
* Copyright (C) 2009  Denis Shienkov
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*
* Contact Denis Shienkov:
*          e-mail: <scapig2@yandex.ru>
*             ICQ: 321789831
*/


/*! \~english

*/

#include <QtCore/QStringList>

#include "serialnotifier.h"
#include "serialnotifier_p.h"

//#define SERIALNOTIFIER_DEBUG

#ifdef SERIALNOTIFIER_DEBUG
#include <QtCore/QDebug>
#endif


//

/*! \~english
    \fn SerialNotifier::SerialNotifier(QObject *parent)
    Default constructor.
*/
SerialNotifier::SerialNotifier(Qt::HANDLE descriptor, Type type, QObject *parent)
    : QObject(parent), d_ptr(new SerialNotifierPrivate())
{
    d_func()->q_ptr = this;
    d_func()->init(descriptor, type);
}

/*! \~english
    \fn SerialNotifier::~SerialNotifier()
    Default destructor.
*/
SerialNotifier::~SerialNotifier()
{
    d_func()->setEnabled(false);
    delete d_ptr;
}

Qt::HANDLE SerialNotifier::descriptor() const
{
    return d_func()->m_descriptor;
}

SerialNotifier::Type SerialNotifier::type() const
{
    return d_func()->m_type;
}

bool SerialNotifier::isEnabled() const
{
    return d_func()->m_enabled;
}

void SerialNotifier::setEnabled(bool enable)
{
    d_func()->setEnabled(enable);
}

